package com.cn.yang.service.impl;

import com.cn.yang.dao.ProductDao;
import com.cn.yang.dao.impl.ProductDaoImpl;
import com.cn.yang.model.production.ProductClassifyModel;
import com.cn.yang.model.production.ProductModel;
import com.cn.yang.service.ProductService;
import com.cn.yang.util.PageUtil;

import java.util.List;

public class ProductServiceImpl implements ProductService {
    //查询产品种类===========
    @Override
    public List<ProductClassifyModel> findClassify() {
        ProductDao productDao = new ProductDaoImpl();
        return productDao.findClassify();
    }
//添加产品信息========
    @Override
    public int addProduct(ProductModel model) {
        ProductDao productDao = new ProductDaoImpl();
        return productDao.addProduct(model);
    }
//查找 产品信息=========
    @Override
    public List<ProductModel> findProduct(ProductModel model) {
        ProductDao productDao = new ProductDaoImpl();
        return productDao.findProduct(model);
    }
//产品总数
    @Override
    public int countProduct() {
        ProductDao productDao = new ProductDaoImpl();
        return productDao.countProduct();
    }
//删除某个产品
    @Override
    public int deleteById(Integer id) {
        ProductDao productDao = new ProductDaoImpl();
        return productDao.deleteById(id);
    }

    @Override
    public ProductModel selectById(Integer id) {
        ProductDao productDao = new ProductDaoImpl();
        return productDao.selectById(id);
    }

    @Override
    public int updateProduct(ProductModel model) {
        ProductDao productDao = new ProductDaoImpl();
        return productDao.updateProduct(model);
    }
}
